package com.nondo.dean.platform.controller.wap.app;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.nondo.dean.platform.domain.SystemArticle;
import com.nondo.dean.platform.service.SystemArticleService;

@Controller("apiWapSystemArticle")
@RequestMapping("/wap/app/system/article")
public class SystemArticleController {

    @Value("${baseUrl}")
    private String baseUrl;

    @Autowired
    SystemArticleService systemArticleService;

    /**
     * 获取活动详情
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping("/{type}")
    public ModelAndView getProductByType(HttpServletRequest request, HttpServletResponse response, @PathVariable("type") String type) {
        ModelAndView mv = new ModelAndView("wap/app/system/article");

        SystemArticle systemArticle = null;
        systemArticle = this.systemArticleService.selectByType(type);
        if (systemArticle == null) {
            systemArticle = new SystemArticle();
        }
        mv.addObject("baseUrl", baseUrl);
        mv.addObject("systemArticle", systemArticle);
        return mv;
    }
}